/*
* Created by duwanfu on 2018/10/29
* */

export default {
  getCookie(name) {
    var r = new RegExp(name + "=(.*?)(;|$)");
    var arr = document.cookie.match(r)
    if (arr && arr.length >= 2) return arr[1];
    return "";
  },
  setCookie(cname, cvalue, exdays) {
    var d = new Date();
    d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
    var expires = "expires=" + d.toGMTString();
    document.cookie = cname + "=" + cvalue + "; " + expires;
  }
}
